home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ddj0897.zip
/
DYN401.ZIP
/
kernel
/
object.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-16
|
5KB
|
242 lines
/* Copyright (c) 1993-1996 Algorithms Corporation */
/* All rights reserved. */
/* This file automatically generated by dpp - do not edit */
#define DPP_STRATEGY 2
#define DPP_FASTWIDE 0
#line 13 "object.d"
#include <math.h>
#define CLASS Object_c
#define ivType Object_iv_t
#include "generics.h"
object Object_c;
#include "object.iv"
#line 21 "object.d"
imeth objrtn Object_im_gError(object self, char *msg)
{
if (File_c)
gPuts(stderrStream, msg);
else {
if (IsObj((object) msg))
msg = gStringValue((object) msg);
fprintf(stderr, "%s", msg);
}
exit(1);
return self;
}
ivmeth objrtn Object_ivm_vError(object self, va_list _rest_)
{ char * fmt = va_arg(_rest_, char *);
char buf[512];
MAKE_REST(fmt);
vsprintf(buf, fmt, _rest_);
return gError(self, buf);
}
#line 54 "object.c"
static objrtn Object_ifm_vError(object self, ...)
{
va_list _rest_;
va_start(_rest_, self);
return Object_ivm_vError(self, _rest_);
}
#line 43 "object.d"
imeth objrtn Object_im_gSubclassResponsibility(object self, char *meth)
{
char buf[100];
object aCls;
aCls = IsaClass(self) ? self : ClassOf(self);
sprintf(buf, "Method %s should be implemented by a subclass of %s\n",
meth, gName(aCls));
return gError(self, buf);
}
imeth objrtn Object_im_gShouldNotImplement(object self, char *meth)
{
char buf[100];
if (IsaClass(self))
sprintf(buf, "Method %s is not appropriate for the %s class\n",
meth, gName(self));
else
sprintf(buf, "Method %s is not appropriate for instances of %s\n",
meth, gName(ClassOf(self)));
return gError(self, buf);
}
#ifndef NOCLASSLIB
imeth objrtn Object_im_gStringRep(object self)
{
object s, t;
s = vSprintf(String, "%s:<%8.8lx> [ ", gName(ClassOf(self)), self);
t = gStringRepValue(self);
vBuild(s, NULL, t, " ]\n", NULL);
gDispose(t);
return s;
}
imeth objrtn Object_im_gStringRepValue(object self)
{
return vSprintf(String, "%s:<%8.8lx>", gName(ClassOf(self)), self);
}
imeth objrtn Object_im_gPrint(object self, object stream)
{
object t;
ChkArg(stream, 2);
t = gStringRep(self);
gPuts(stream, (char *) t);
gDispose(t);
return self;
}
imeth objrtn Object_im_gPrintValue(object self, object stream)
{
object t;
ChkArg(stream, 2);
t = gStringRepValue(self);
gPuts(stream, (char *) t);
gDispose(t);
return self;
}
#endif
imeth int Object_im_gHash(object self)
{
double t;
t = .6125423371 * (double)(unsigned long) self;
t = t < 0.0 ? -t : t;
return (int) (BIG_INT * (t - floor(t)));
}
imeth int Object_im_gCompare(object self, object obj2)
{
if (EQ(self, obj2))
return 0;
ChkArg(obj2, 2);
if ((unsigned long) self < (unsigned long) obj2)
return -1;
else
return 1;
}
imeth int Object_im_gIsKindOf(object self, object aCls)
{
static gIsKindOf_t class_IsKindOf = NULL;
if (!class_IsKindOf)
class_IsKindOf = imcPointer(Behavior, gIsKindOf);
return class_IsKindOf(ClassOf(self), aCls);
}
imeth objrtn Object_im_gInit(object self)
{
return self;
}
objrtn Object_initialize(void)
{
static int done = 0;
if (done)
return Object_c;
done = 1;
iMethodFor(Object, gError, Object_im_gError);
#if DPP_STRATEGY == 1
ivMethodFor(Object, vError, Object_ivm_vError, Object_ivm_vError);
#else
ivMethodFor(Object, vError, Object_ivm_vError, Object_ifm_vError);
#endif
iMethodFor(Object, gSubclassResponsibility, Object_im_gSubclassResponsibility);
iMethodFor(Object, gShouldNotImplement, Object_im_gShouldNotImplement);
iMethodFor(Object, gHash, Object_im_gHash);
iMethodFor(Object, gCompare, Object_im_gCompare);
iMethodFor(Object, gIsKindOf, Object_im_gIsKindOf);
iMethodFor(Object, gInit, Object_im_gInit);
#ifndef NOCLASSLIB
iMethodFor(Object, gStringRep, Object_im_gStringRep);
iMethodFor(Object, gStringRepValue, Object_im_gStringRepValue);
iMethodFor(Object, gPrint, Object_im_gPrint);
iMethodFor(Object, gPrintValue, Object_im_gPrintValue);
#endif
return Object_c;
}
#if 0
imeth objrtn Object_im_gDispose(object self)
#line 183 "object.d"
{}
#line 184 "object.d"
imeth int Object_im_gEqual(object self, object obj2)
#line 184 "object.d"
{}
#line 185 "object.d"
imeth objrtn Object_im_gCopy(object self)
#line 185 "object.d"
{}
#line 186 "object.d"
imeth int Object_im_gSize(object self)
#line 186 "object.d"
{}
#line 187 "object.d"
imeth int Object_im_gBasicSize(object self)
#line 187 "object.d"
{}
#endif